package com.example.runningdemo.designModel.builder;

/**
 * @program: Running-Demo
 * @description: 车具体建造者
 * @author: kangwei
 * @create: 2024-08-11 14:43
 **/
public class CarDirector {

    /**
     * 组装建造者
     *
     * @param personBuilder
     * @return
     */
    public Car createCarBuilder(PersonBuilder personBuilder) {
        personBuilder.builderName();
        personBuilder.builderTyre();
        personBuilder.builderGlass();
        return personBuilder.createCar();
    }

    public static void main(String[] args) {
        CarDirector carDirector = new CarDirector();
        Car carBuilder = carDirector.createCarBuilder(new CarBuilder());
        System.out.println(carBuilder.getName());
    }
}
